import Vue from 'vue'
import Router from 'vue-router'
import home from '@/components/Home'
import ai from '@/components/Ai'
import backed from '@/components/Backed'
import devops from '@/components/Devops'
import fronted from '@/components/Fronted'
import java from '@/components/Java'
import other from '@/components/Other'
import python from '@/components/Python'
import security from '@/components/Security'
import Login from '@/pages/user_manage/Login'
import Register from '@/pages/user_manage/Register'
import user_home_profile from '@/pages/user_manage/User_home_profile'
import user_chatroom from '@/pages/user_manage/User_home_chatroom'
import user_blog from '@/pages/user_manage/User_home_blog'
import user_follow from '@/pages/user_manage/User_home_follow'
import user_fans from '@/pages/user_manage/User_home_fans'
import fwb from '@/pages/blog_manage/Fwb'
import markdown from '@/pages/blog_manage/Markdown'
import blogmanage from '@/pages/blog_manage/Blogmanage'
import readblog from '@/pages/blog_manage/ReadBlog'

import AdminRegister from '@/pages/admin_manage/AdminRegister' 
import AdminLogin from '@/pages/admin_manage/AdminLogin' 
import AdminManage from '@/pages/admin_manage/AdminManage' 


Vue.use(Router)

export default new Router({
  //去掉路径中的#
  // mode: 'history',
  routes: [
    {
      path: '/',
      name: 'home',
      component: home
    },
    {
      path: '/ai',
      name: 'ai',
      component: ai
    },
    {
      path: '/backed',
      name: 'backed',
      component: backed
    },
    {
      path: '/devops',
      name: 'devops',
      component: devops
    },
    {
      path: '/fronted',
      name: 'fronted',
      component: fronted
    },
    {
      path: '/java',
      name: 'java',
      component: java
    },
    {
      path: '/other',
      name: 'other',
      component: other
    },
    {
      path: '/python',
      name: 'python',
      component: python
    },
    {
      path: '/security',
      name: 'security',
      component: security
    },
    {
      path: '/user/login',
      name: 'login',
      component: Login,
      meta: {afterLogin: true}
    },
    {
      path: '/user/register',
      name: 'register',
      component:Register,
      meta: {afterLogin: true}
    },
    {
      path: '/user/profile',
      name: 'user_home',
      component:user_home_profile,
    },
    {
      path: '/user/chatroom',
      name: 'user_chatroom',
      component:user_chatroom,
    },
    {
      path: '/user/blog',
      name: 'user_blog',
      component:user_blog
    },
    {
      path: '/user/follow',
      name: 'user_follow',
      component:user_follow
    },
    {
      path: '/user/fans',
      name: 'user_fans',
      component:user_fans
    },
    {
      path: '/blog/fwb',
      name: 'fwb',
      component:fwb
    },
    {
      path: '/blog/markdown',
      name: 'markdown',
      component:markdown
    },
    {
      path: '/blogInfo/viewArticle/:username/p/:blogid',
      name: 'manage',
      component:blogmanage,
      meta: { title: '/blogInfo/viewArticle' }
    },
    {
      path: '/tblog/p/:blogid',
      name: 'readblog',
      component:readblog,
      meta:{title:'/tblog'}
    },
    {
      path: '/admin/register',
      name: 'adminregister',
      component:AdminRegister
    },
    {
      path: '/admin/login',
      name: 'adminlogin',
      component:AdminLogin
    },
    {
      path: '/admin/manage',
      name: 'adminmanage',
      component:AdminManage
    }
  ]
})
